const LpCore = require('./LpCore.js');
const LpRule = require('./LpRule.js');

function LpApp() {

    const lpCore = new LpCore();
    const lpRule = new LpRule();
    var p_oContext = {
        sFileName: ""
    };

    return {

        start: function (sFileName) {
            p_oContext.sFileName = sFileName;
            this.run(p_oContext);
        },

        run: function (oContext) {
            lpCore.setLpRule(lpRule).parseWrapper(oContext.sFileName).calcWrapper();
        },

        stop: function () {
            // TODO: clean up
        }
    };
}

module.exports = LpApp;